<style type="text/css">
#FieldList{
	padding:4px 0px;
}
#FieldList table{
	width:100%;
	background:#AAA;
}
#FieldList td{
	background:#F8F0F4;
}
.xysize{
	margin-left:24px;
	color: #aaa;
}
.xysize input{
	width:30px ;
	border-width:0px 0px 1px;
	border-style: dotted ;
	border-color: #f00;
	background: #FFF4F8 ;
	color: #666 ;
}
</style>

<form method="post" action="{-$body.url-}&act={-if $L.id-}eok&id={-$L.id-}{-else-}aok{-/if-}">

<div class="bodytabdiv">
<table class='bodytab' cellspacing='1' id="table_form">
<tr>
	<th class='th' colspan='2'>{-if $L.id-}修改{-else-}添加{-/if-}数据表</th>
</tr>

<tr>
	<td width='120'>数据表</td>
	<td><input name="tableName" value='{-$L.tableName-}'></td>
</tr>
<tr>
	<td width='120'>表描述</td>
	<td><input name="description" value='{-$L.description-}'></td>
</tr>


<tr>
	<td width='120'>条目名称</td>
	<td><input name="itemName" value='{-$L.itemName-}'></td>
</tr>

<tr>
 <td>是否分组</td>
 <td>
	<label for="d_isGroup1"><input type="radio" name="isGroup" id="d_isGroup1" value='1'{-if $L.isGroup-} checked='true'{-/if-}>是</label>
	<label for="d_isGroup0"><input type="radio" name="isGroup" id="d_isGroup0" value='0'{-if !$L.isGroup-} checked='true'{-/if-}>否</label>
 </td>
</tr>

<tr>
 <td>是否新表单</td>
 <td>
	<label for="d_isForm831"><input type="radio" name="isForm83" id="d_isForm831" value='1'{-if $L.isForm83-} checked='true'{-/if-}>是</label>
	<label for="d_isForm830"><input type="radio" name="isForm83" id="d_isForm830" value='0'{-if !$L.isForm83-} checked='true'{-/if-}>否</label>
 </td>
</tr>


{-if $L.id-}
<tr depends="isGroup:[1]">
	<td>字段显示</td>
	<td>
		<div id="FieldList"><table cellspacing='1'>
		<tr>
			<th width="90">字段</th>
			<th width="120">分组</th>
			<th>属性</th>
		</tr>
		{-foreach from=$Fields key=fid item=a-}
			<tr>
				<td>{-$a.fieldName-}</td>
				
				<td>
					<select name="gid[{-$fid-}]">
						<option value="0">- </option>
						{-foreach from=$Groups key=k item=v-}
							<option value="{-$k-}" {-if $k==$a.gid-} selected="selected" {-/if-}>{-$v.name-}</option>
						{-/foreach-}
					</select>
				</td>

				<td class="otherField">
					{-foreach from=$ShowTypes key=k item=v-}
						<label for="si_{-$fid-}_{-$k-}">
							<input id="si_{-$fid-}_{-$k-}" type="radio" value="{-$k-}" name="si[{-$fid-}]"
								{-if $L.ShowInfo[$fid].0 !="" -}
									{-if $k== $L.ShowInfo[$fid].0 -}
										checked="checked"
									{-/if-}
								{-else-}
									{-if $k=="no"-}
										checked="checked"
									{-/if-}
								{-/if-}
							/>
							{-$v-}
						</label>
					{-/foreach-}

					<span class="xysize">
						<input type="text" maxlength="3" name="sx[{-$fid-}]" value="{-$L.ShowInfo[$fid].1-}"/>
						.
						<input type="text" maxlength="3" name="sy[{-$fid-}]" value="{-$L.ShowInfo[$fid].2-}"/>
						.
						<input type="text" maxlength="3" name="sz[{-$fid-}]" value="{-$L.ShowInfo[$fid].3-}"/>
					</span>
				</td>
			</tr>
		{-/foreach-}
		</table></div>
	</td>
</tr>
{-/if-}


</table>
</div>


<input type='hidden' name='jurl' value='{-php-}echo $_SERVER['HTTP_REFERER']{-/php-}'>

<div class='bodysubmit'>
<input type='submit' value='递交'>
<input type='reset' value='默认'>
</div>

</form>

<div class='bodyfooter'>
	<a href='{-$_ENV.referer-}'>返回</a>
</div>

<script type="text/javascript">
new XForm('table_form', function(){
	var elements	= this.dom.elements;
	try{
		var e = elements["tableName"];	if(!e.value.match(/^[\w\_]{2,20}$/)){
			alert('数据表名不能少于2个字母,并且不能包含特殊字符!');	e.select();e.focus(); return true;
		}
	}catch(e){
		return true;
	}
});

$$(".xysize input").addEvent('keypress', function(evt){
	if( evt.code < 48 || evt.code > 57 ){
		if( evt.code > 16 && evt.code!=39 && evt.code!=37 ){
			evt.stop();
		}
	}
});
</script>